/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package main;

import constant.ConnectionPool;
import constant.IndexConst;
import indexer.AuthorCitationIndexer;
import indexer.AuthorCoAuthorIndexer;
import indexer.AuthorConfIndexer;
import indexer.AuthorIndexer;
import indexer.AuthorJournalIndexer;
import indexer.AuthorKeyIndexer;
import indexer.CcidfIndexer;
import indexer.CheckSpellIndexer;
import indexer.ConferenceIndexer;
import indexer.ConferenceKeyIndexer;
import indexer.IndexAutocomplete;
import indexer.JournalIndexer;
import indexer.JournalKeyIndexer;
import indexer.KeywordIndexer;
import indexer.OrgIndexer;
import indexer.OrgKeyIndexer;
import indexer.PaperIndexer;
import indexer.SubdomainIndexer;
import indexer._RankAuthorIndexer;
import indexer._RankConfIndexer;
import indexer._RankJournalIndexer;
import indexer._RankKeyIndexer;
import indexer._RankOrgIndexer;
import indexer._Rank_Paper;
import java.io.File;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.swing.SwingWorker;

/**
 *
 * @author tiendv
 */
public class MainIndexForm extends javax.swing.JFrame {

    private String path = "E:\\";
    private Boolean aut = false;
    private Boolean con = false;
    private Boolean jou = false;
    private Boolean org = false;
    private Boolean key = false;
    private Boolean rankPaper = false;
    private Boolean IndexPaper = false;

    /**
     * Creates new form MainIndexForm
     */
    public MainIndexForm() {
        initComponents();
        this.setDisabledAll();
        setEnabledAll();
    }

    /**
     * This method is called from within the constructor to initialize the form.
     * WARNING: Do NOT modify this code. The content of this method is always
     * regenerated by the Form Editor.
     */
    @SuppressWarnings("unchecked")
    // <editor-fold defaultstate="collapsed" desc="Generated Code">//GEN-BEGIN:initComponents
    private void initComponents() {

        jLabel1 = new javax.swing.JLabel();
        jLabel2 = new javax.swing.JLabel();
        txtUserName = new javax.swing.JTextField();
        txtPassWord = new javax.swing.JTextField();
        jLabel3 = new javax.swing.JLabel();
        txtDatabase = new javax.swing.JTextField();
        jLabel4 = new javax.swing.JLabel();
        txtPort = new javax.swing.JTextField();
        btPaperIndexer = new javax.swing.JButton();
        prBar = new javax.swing.JProgressBar();
        jScrollPane1 = new javax.swing.JScrollPane();
        txtalog = new javax.swing.JTextArea();
        btRankPaper = new javax.swing.JButton();
        btAuthorIndexer = new javax.swing.JButton();
        btConferenceIndexer = new javax.swing.JButton();
        btJournalIndexer = new javax.swing.JButton();
        btKeywordIndexer = new javax.swing.JButton();
        btOrgIndexer = new javax.swing.JButton();
        btSubdomainIndexer = new javax.swing.JButton();
        txtPath = new javax.swing.JTextField();
        jLabel5 = new javax.swing.JLabel();
        btCcidfIndexer = new javax.swing.JButton();
        btRankAuthorIndexer = new javax.swing.JButton();
        btRankConfIndexer = new javax.swing.JButton();
        btRankJournalIndexer = new javax.swing.JButton();
        btRankKeyIndexer = new javax.swing.JButton();
        btRankOrgIndexer = new javax.swing.JButton();
        btAutocompleteIndexer = new javax.swing.JButton();
        btCheckSpellIndexer = new javax.swing.JButton();
        btAutoRun = new javax.swing.JButton();
        btAuthorCitation = new javax.swing.JButton();
        btAuthorCoAuthor = new javax.swing.JButton();
        btAuthorConference = new javax.swing.JButton();
        btAuthorJournal = new javax.swing.JButton();
        btAuthorKeyword = new javax.swing.JButton();
        btConferenceKeyword = new javax.swing.JButton();
        btJournalKeyword = new javax.swing.JButton();
        btOrgKeyword = new javax.swing.JButton();

        setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);
        setTitle("Index data PubGuru");
        setResizable(false);

        jLabel1.setText("Username");

        jLabel2.setText("PassWord");

        txtUserName.setText("root");

        txtPassWord.setText("root");

        jLabel3.setText("Database");

        txtDatabase.setText("cspublicationcrawler");

        jLabel4.setText("Port");

        txtPort.setText("3306");

        btPaperIndexer.setText("PaperIndexer");
        btPaperIndexer.setToolTipText("Create INDEX-PAPER");
        btPaperIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btPaperIndexerActionPerformed(evt);
            }
        });

        txtalog.setColumns(20);
        txtalog.setRows(5);
        jScrollPane1.setViewportView(txtalog);

        btRankPaper.setText("RankPaper");
        btRankPaper.setToolTipText("Create table Rank Paper in MySQL");
        btRankPaper.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btRankPaperActionPerformed(evt);
            }
        });

        btAuthorIndexer.setText("AuthorIndexer");
        btAuthorIndexer.setToolTipText("Create INDEX-AUTHOR");
        btAuthorIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btAuthorIndexerActionPerformed(evt);
            }
        });

        btConferenceIndexer.setText("ConferenceIndexer");
        btConferenceIndexer.setToolTipText("Create INDEX-CONFERENCE");
        btConferenceIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btConferenceIndexerActionPerformed(evt);
            }
        });

        btJournalIndexer.setText("JournalIndexer");
        btJournalIndexer.setToolTipText("Create INDEX-JOURNAL");
        btJournalIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btJournalIndexerActionPerformed(evt);
            }
        });

        btKeywordIndexer.setText("KeywordIndexer");
        btKeywordIndexer.setToolTipText("Create INDEX-KEYWORD");
        btKeywordIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btKeywordIndexerActionPerformed(evt);
            }
        });

        btOrgIndexer.setText("OrgIndexer");
        btOrgIndexer.setToolTipText("Create INDEX-ORGANIZATION");
        btOrgIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btOrgIndexerActionPerformed(evt);
            }
        });

        btSubdomainIndexer.setText("SubdomainIndexer");
        btSubdomainIndexer.setToolTipText("Create INDEX-SUBDOMAIN");
        btSubdomainIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btSubdomainIndexerActionPerformed(evt);
            }
        });

        txtPath.setText("E:\\INDEX");

        jLabel5.setText("Path");

        btCcidfIndexer.setText("CcidfIndexer");
        btCcidfIndexer.setToolTipText("Create INDEX-CCIDF");
        btCcidfIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btCcidfIndexerActionPerformed(evt);
            }
        });

        btRankAuthorIndexer.setText("RankAuthorIndexer");
        btRankAuthorIndexer.setToolTipText("Create INDEX-RANK-AUTHOR");
        btRankAuthorIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btRankAuthorIndexerActionPerformed(evt);
            }
        });

        btRankConfIndexer.setText("RankConfIndexer");
        btRankConfIndexer.setToolTipText("Create INDEX-RANK-CONFERENCE");
        btRankConfIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btRankConfIndexerActionPerformed(evt);
            }
        });

        btRankJournalIndexer.setText("RankJournalIndexer");
        btRankJournalIndexer.setToolTipText("Create INDEX-RANK-JOURNAL");
        btRankJournalIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btRankJournalIndexerActionPerformed(evt);
            }
        });

        btRankKeyIndexer.setText("RankKeyIndexer");
        btRankKeyIndexer.setToolTipText("Create INDEX-RANK-KEYWORD");
        btRankKeyIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btRankKeyIndexerActionPerformed(evt);
            }
        });

        btRankOrgIndexer.setText("RankOrgIndexer");
        btRankOrgIndexer.setToolTipText("Create INDEX-RANK-ORGANIZATION");
        btRankOrgIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btRankOrgIndexerActionPerformed(evt);
            }
        });

        btAutocompleteIndexer.setText("AutocompleteIndexer");
        btAutocompleteIndexer.setToolTipText("Create INDEX-AUTOCOMPLETE");
        btAutocompleteIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btAutocompleteIndexerActionPerformed(evt);
            }
        });

        btCheckSpellIndexer.setText("CheckSpellIndexer");
        btCheckSpellIndexer.setToolTipText("Create INDEX-CHECKSPELL");
        btCheckSpellIndexer.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btCheckSpellIndexerActionPerformed(evt);
            }
        });

        btAutoRun.setText("AutoRunIndexer");
        btAutoRun.setToolTipText("Autho Create all INDEX File");
        btAutoRun.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btAutoRunActionPerformed(evt);
            }
        });

        btAuthorCitation.setText("AuthorCitationIndexer");
        btAuthorCitation.setToolTipText("Create INDEX-AUTHOR-CITATION");
        btAuthorCitation.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btAuthorCitationActionPerformed(evt);
            }
        });

        btAuthorCoAuthor.setText("AuthorCoAuthorIndexer");
        btAuthorCoAuthor.setToolTipText("Create INDEX-AUTHOR-COAUTHOR");
        btAuthorCoAuthor.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btAuthorCoAuthorActionPerformed(evt);
            }
        });

        btAuthorConference.setText("AuthorConferenceIndexer");
        btAuthorConference.setToolTipText("Create INDEX-AUTHOR-CONFERENCE");
        btAuthorConference.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btAuthorConferenceActionPerformed(evt);
            }
        });

        btAuthorJournal.setText("AuthorJournalIndexer");
        btAuthorJournal.setToolTipText("Create INDEX-AUTHOR-JOURNAL");
        btAuthorJournal.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btAuthorJournalActionPerformed(evt);
            }
        });

        btAuthorKeyword.setText("AuthorKeywordIndexer");
        btAuthorKeyword.setToolTipText("Create INDEX-AUTHOR-KEYWORD");
        btAuthorKeyword.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btAuthorKeywordActionPerformed(evt);
            }
        });

        btConferenceKeyword.setText("ConferenceKeywordIndexer");
        btConferenceKeyword.setToolTipText("Create INDEX-CONFERENCE-KEYWORD");
        btConferenceKeyword.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btConferenceKeywordActionPerformed(evt);
            }
        });

        btJournalKeyword.setText("JournalKeywordIndexer");
        btJournalKeyword.setToolTipText("Create INDEX-JOURNAL-KEYWORD");
        btJournalKeyword.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btJournalKeywordActionPerformed(evt);
            }
        });

        btOrgKeyword.setText("OrgKeywordIndexer");
        btOrgKeyword.setToolTipText("Create INDEX-ORG-KEYWORD");
        btOrgKeyword.addActionListener(new java.awt.event.ActionListener() {
            public void actionPerformed(java.awt.event.ActionEvent evt) {
                btOrgKeywordActionPerformed(evt);
            }
        });

        javax.swing.GroupLayout layout = new javax.swing.GroupLayout(getContentPane());
        getContentPane().setLayout(layout);
        layout.setHorizontalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addContainerGap()
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addComponent(prBar, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, Short.MAX_VALUE)
                    .addComponent(jScrollPane1)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                        .addGap(0, 0, Short.MAX_VALUE)
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.CENTER)
                                        .addComponent(btAuthorIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(btRankAuthorIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addComponent(btCheckSpellIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(btRankPaper, javax.swing.GroupLayout.Alignment.TRAILING, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(18, 18, 18)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(btPaperIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(btSubdomainIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(btRankConfIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(btRankJournalIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(btRankOrgIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(btRankKeyIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(btConferenceIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(btJournalIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(btOrgIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(18, 18, 18)
                                        .addComponent(btKeywordIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(btAutocompleteIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)))
                            .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createSequentialGroup()
                                .addComponent(btAutoRun, javax.swing.GroupLayout.PREFERRED_SIZE, 288, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(btCcidfIndexer, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(306, 306, 306))))
                    .addGroup(layout.createSequentialGroup()
                        .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                            .addGroup(layout.createSequentialGroup()
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.TRAILING)
                                    .addComponent(jLabel1)
                                    .addComponent(jLabel4))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                                    .addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                    .addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                                .addGap(50, 50, 50)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addComponent(jLabel3)
                                    .addGroup(layout.createSequentialGroup()
                                        .addGap(24, 24, 24)
                                        .addComponent(jLabel5)))
                                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING, false)
                                    .addGroup(layout.createSequentialGroup()
                                        .addComponent(txtDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                        .addGap(58, 58, 58)
                                        .addComponent(jLabel2)
                                        .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                                        .addComponent(txtPassWord, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                                    .addComponent(txtPath)))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(btAuthorCitation, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(btAuthorCoAuthor, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(btAuthorConference, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(btAuthorJournal, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(btAuthorKeyword, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE))
                            .addGroup(layout.createSequentialGroup()
                                .addComponent(btConferenceKeyword, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(btJournalKeyword, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)
                                .addGap(18, 18, 18)
                                .addComponent(btOrgKeyword, javax.swing.GroupLayout.PREFERRED_SIZE, 135, javax.swing.GroupLayout.PREFERRED_SIZE)))
                        .addGap(0, 0, Short.MAX_VALUE)))
                .addContainerGap())
        );
        layout.setVerticalGroup(
            layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
            .addGroup(layout.createSequentialGroup()
                .addGap(22, 22, 22)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(jLabel1)
                    .addComponent(txtUserName, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel3)
                    .addComponent(txtDatabase, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(jLabel2, javax.swing.GroupLayout.PREFERRED_SIZE, 17, javax.swing.GroupLayout.PREFERRED_SIZE)
                    .addComponent(txtPassWord, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel4)
                        .addComponent(txtPort, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE))
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(jLabel5)
                        .addComponent(txtPath, javax.swing.GroupLayout.PREFERRED_SIZE, javax.swing.GroupLayout.DEFAULT_SIZE, javax.swing.GroupLayout.PREFERRED_SIZE)))
                .addGap(14, 14, 14)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btAutoRun)
                    .addComponent(btCcidfIndexer))
                .addGap(15, 15, 15)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btRankPaper)
                    .addComponent(btPaperIndexer)
                    .addComponent(btSubdomainIndexer))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
                    .addGroup(javax.swing.GroupLayout.Alignment.TRAILING, layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                        .addComponent(btConferenceIndexer)
                        .addComponent(btJournalIndexer)
                        .addComponent(btOrgIndexer)
                        .addComponent(btKeywordIndexer))
                    .addComponent(btAuthorIndexer, javax.swing.GroupLayout.Alignment.TRAILING))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btRankAuthorIndexer)
                    .addComponent(btRankConfIndexer)
                    .addComponent(btRankJournalIndexer)
                    .addComponent(btRankOrgIndexer)
                    .addComponent(btRankKeyIndexer))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btAutocompleteIndexer)
                    .addComponent(btCheckSpellIndexer))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btAuthorCitation)
                    .addComponent(btAuthorCoAuthor)
                    .addComponent(btAuthorConference)
                    .addComponent(btAuthorJournal)
                    .addComponent(btAuthorKeyword))
                .addGap(18, 18, 18)
                .addGroup(layout.createParallelGroup(javax.swing.GroupLayout.Alignment.BASELINE)
                    .addComponent(btConferenceKeyword)
                    .addComponent(btJournalKeyword)
                    .addComponent(btOrgKeyword))
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(prBar, javax.swing.GroupLayout.PREFERRED_SIZE, 34, javax.swing.GroupLayout.PREFERRED_SIZE)
                .addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
                .addComponent(jScrollPane1, javax.swing.GroupLayout.DEFAULT_SIZE, 156, Short.MAX_VALUE)
                .addContainerGap())
        );

        pack();
    }// </editor-fold>//GEN-END:initComponents

    private void btPaperIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btPaperIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);

            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                //this.btPaperIndexer.setEnabled(true);
                this.btRankPaper.setEnabled(true);
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.PAPER_INDEX_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }

            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-PAPER is running \n");
                        PaperIndexer index = new PaperIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        IndexPaper = true;

                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.append(ex.getMessage());
        }
    }//GEN-LAST:event_btPaperIndexerActionPerformed

    private void btRankPaperActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btRankPaperActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                prBar.setIndeterminate(false);
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nRank Paper is running \n");
                        _Rank_Paper rank = new _Rank_Paper();
                        txtalog.append(rank._run(connectionPool));
                        rankPaper = true;
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.setText(ex.getMessage());
        }
    }//GEN-LAST:event_btRankPaperActionPerformed

    private void btAuthorIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAuthorIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.AUTHOR_INDEX_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-AUTHOR is running \n");
                        AuthorIndexer index = new AuthorIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        aut = true;
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.append(ex.getMessage());
        }
    }//GEN-LAST:event_btAuthorIndexerActionPerformed

    private void btConferenceIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btConferenceIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.CONFERENCE_INDEX_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-CONFERENCE is running \n");
                        ConferenceIndexer index = new ConferenceIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        con = true;
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.append(ex.getMessage());
        }
    }//GEN-LAST:event_btConferenceIndexerActionPerformed

    private void btJournalIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btJournalIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.JOURNAL_INDEX_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-JOURNAL is running \n");
                        JournalIndexer index = new JournalIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        jou = true;
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.setText(ex.getMessage());
        }
    }//GEN-LAST:event_btJournalIndexerActionPerformed

    private void btKeywordIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btKeywordIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.KEYWORD_INDEX_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-KEYWORD is running \n");
                        KeywordIndexer index = new KeywordIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        key = true;
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.setText(ex.getMessage());
        }
    }//GEN-LAST:event_btKeywordIndexerActionPerformed

    private void btOrgIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btOrgIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.ORG_INDEX_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-ORGANIZATION is running \n");
                        OrgIndexer index = new OrgIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        org = true;
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    prBar.setIndeterminate(false);
                    txtalog.append("\nFinished!\n");
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.setText(ex.getMessage());
        }
    }//GEN-LAST:event_btOrgIndexerActionPerformed

    private void btSubdomainIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btSubdomainIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.SUBDOMAIN_INDEX_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-SUBDOMAIN is running \n");
                        SubdomainIndexer index = new SubdomainIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.setText(ex.getMessage());
        }
    }//GEN-LAST:event_btSubdomainIndexerActionPerformed

    private void btCcidfIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCcidfIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                prBar.setIndeterminate(false);
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.CCIDF_INDEX_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-CCIDF is running \n");
                        CcidfIndexer index = new CcidfIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.setText(ex.getMessage());
        }
    }//GEN-LAST:event_btCcidfIndexerActionPerformed

    private void btRankAuthorIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btRankAuthorIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.RANK_AUTHOR_INDEX_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Index
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-RANK-AUTHOR is running \n");
                        _RankAuthorIndexer index = new _RankAuthorIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.setText(ex.getMessage());
        }
    }//GEN-LAST:event_btRankAuthorIndexerActionPerformed

    private void btRankConfIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btRankConfIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.RANK_CONFERENCE_INDEX_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Index
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-RANK-CONFERENCE is running \n");
                        _RankConfIndexer index = new _RankConfIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.setText(ex.getMessage());
        }
    }//GEN-LAST:event_btRankConfIndexerActionPerformed

    private void btRankJournalIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btRankJournalIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.RANK_JOURNAL_INDEX_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Index
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-RANK-JOURNAL is running \n");
                        _RankJournalIndexer index = new _RankJournalIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.setText(ex.getMessage());
        }
    }//GEN-LAST:event_btRankJournalIndexerActionPerformed

    private void btRankKeyIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btRankKeyIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.RANK_KEYWORD_INDEX_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Index
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-RANK-KEYWORD is running \n");
                        _RankKeyIndexer index = new _RankKeyIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.setText(ex.getMessage());
        }
    }//GEN-LAST:event_btRankKeyIndexerActionPerformed

    private void btRankOrgIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btRankOrgIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.RANK_ORG_INDEX_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Index
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-RANK-ORGANIZATION is running \n");
                        _RankOrgIndexer index = new _RankOrgIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.setText(ex.getMessage());
        }
    }//GEN-LAST:event_btRankOrgIndexerActionPerformed

    private void btAutocompleteIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAutocompleteIndexerActionPerformed
        // TODO add your handling code here:

        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.AUTOCOMPLETE_DIRECTORY_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Index
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    IndexAutocomplete Index = new IndexAutocomplete(path);
                    txtalog.append("Connect database success!\nINDEX-AUTOCOMPLETE is running \n");
                    txtalog.append(Index._run());
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (IOException ex) {
            Logger.getLogger(MainIndexForm.class.getName()).log(Level.SEVERE, null, ex);
        }

    }//GEN-LAST:event_btAutocompleteIndexerActionPerformed

    private void btCheckSpellIndexerActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btCheckSpellIndexerActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.CHECKSPELL_DIRECTORY_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Index
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    CheckSpellIndexer Index = new CheckSpellIndexer(path);
                    txtalog.append("Connect database success!\nINDEX-CHECKSPELL is running \n");
                    txtalog.append(Index._run());
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (IOException ex) {
            Logger.getLogger(MainIndexForm.class.getName()).log(Level.SEVERE, null, ex);
        }
    }//GEN-LAST:event_btCheckSpellIndexerActionPerformed

    private void btAutoRunActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAutoRunActionPerformed
        // TODO add your handling code here:
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                prBar.setIndeterminate(false);
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            //Create Table RankPaper
            SwingWorker<String, Void> Index = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {

                    //Create table RankPaper
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("\n------------------CREATE-RANK-PAPER---------------------\n");
                        txtalog.append("Connect database success!\nRank Paper is running \n");
                        //_Rank_Paper rank = new _Rank_Paper();
                        //txtalog.append(rank._run(connectionPool));
                        rankPaper = true;
                        txtalog.append("\nRank Paper is finished!");
                        txtalog.append("\n-----------------------------------------------------------------------\n");
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //Create INDEX-PAPER
                    File indexDir = new File(path + IndexConst.PAPER_INDEX_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    txtalog.append("\n---------------------------INDEX-PAPER------------------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-PAPER is running \n");
                        PaperIndexer index = new PaperIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        IndexPaper = true;
                        txtalog.append("\nINDEX-PAPER is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    //Create INDEX-AUTHOR
                    indexDir = new File(path + IndexConst.AUTHOR_INDEX_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    txtalog.append("\n------------------------INDEX-AUTHOR-------------------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-AUTHOR is running \n");
                        AuthorIndexer index = new AuthorIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        aut = true;
                        txtalog.append("\nINDEX-AUTHOR is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-CONFERENCE
                    // Delete folder
                    indexDir = new File(path + IndexConst.CONFERENCE_INDEX_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    // Connect Database
                    txtalog.append("\n-------------------INDEX-CONFERENCE---------------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-CONFERENCE is running \n");
                        ConferenceIndexer index = new ConferenceIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        con = true;
                        txtalog.append("\nINDEX-CONFERENCE is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-JOURNAL
                    indexDir = new File(path + IndexConst.JOURNAL_INDEX_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    txtalog.append("\n-----------------------INDEX-JOURNAL-------------------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-JOURNAL is running \n");
                        JournalIndexer index = new JournalIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        jou = true;
                        txtalog.append("\nINDEX-JOURNAL is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-ORGANIZATION
                    indexDir = new File(path + IndexConst.ORG_INDEX_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    // Connect Database
                    txtalog.append("\n------------------INDEX-ORGANIZATION----------------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-ORGANIZATION is running \n");
                        OrgIndexer index = new OrgIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        org = true;
                        txtalog.append("\nINDEX-ORGANIZATION is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-KEYWORD
                    indexDir = new File(path + IndexConst.KEYWORD_INDEX_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    // Connect Database
                    txtalog.append("\n-----------------------INDEX-KEYWORD-----------------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-KEYWORD is running \n");
                        KeywordIndexer index = new KeywordIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        key = true;
                        txtalog.append("\nINDEX-KEYWORD is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-SUBDOMAIN
                    indexDir = new File(path + IndexConst.SUBDOMAIN_INDEX_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    // Connect Database
                    txtalog.append("\n---------------------INDEX-SUBDOMAIN-----------------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-SUBDOMAIN is running \n");
                        SubdomainIndexer index = new SubdomainIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-SUBDOMAIN is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-AUTHOR-CITATION
                    indexDir = new File(path + IndexConst.AUTHOR_CITATION_DIRECTORY_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    txtalog.append("\n-----------------INDEX-AUTHOR-CITATION-----------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-AUTHOR-CITATION is running \n");
                        AuthorCitationIndexer index = new AuthorCitationIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-AUTHOR-CITATION is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-AUTHOR-KEYWORD
                    indexDir = new File(path + IndexConst.AUTHOR_KEYWORD_DIRECTORY_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    txtalog.append("\n----------------INDEX-AUTHOR-KEYWORD----------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-AUTHOR-KEYWORD is running \n");
                        AuthorKeyIndexer index = new AuthorKeyIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-AUTHOR-KEYWORD is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-AUTHOR-CoAUTHOR
                    indexDir = new File(path + IndexConst.AUTHOR_COAUTHOR_DIRECTORY_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    txtalog.append("\n--------------INDEX-AUTHOR-COAUTHOR----------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-AUTHOR-COAUTHOR is running \n");
                        AuthorCoAuthorIndexer index = new AuthorCoAuthorIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-AUTHOR-COAUTHOR is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-AUTHOR-CONFERENCE
                    indexDir = new File(path + IndexConst.AUTHOR_CONFERENCE_DIRECTORY_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    txtalog.append("\n-------------INDEX-AUTHOR-CONFERENCE-------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-AUTHOR-CONFERENCE is running \n");
                        AuthorConfIndexer index = new AuthorConfIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-AUTHOR-CONFERENCE is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-AUTHOR-JOURNAL
                    indexDir = new File(path + IndexConst.AUTHOR_JOURNAL_DIRECTORY_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    txtalog.append("\n----------------INDEX-AUTHOR-JOURNAL-----------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-AUTHOR-JOURNAL is running \n");
                        AuthorJournalIndexer index = new AuthorJournalIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-AUTHOR-JOURNAL is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-CONFERENCE-KEYWORD
                    indexDir = new File(path + IndexConst.CONFERENCE_KEYWORD_DIRECTORY_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    txtalog.append("\n-----------INDEX-CONFERENCE-KEYWORD------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-CONFERENCE-KEYWORD is running \n");
                        ConferenceKeyIndexer index = new ConferenceKeyIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-CONFERENCE-KEYWORD is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-JOURNAL-KEYWORD
                    indexDir = new File(path + IndexConst.JOURNAL_KEYWORD_DIRECTORY_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    txtalog.append("\n---------------INDEX-JOURNAL-KEYWORD----------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-JOURNAL-KEYWORD is running \n");
                        JournalKeyIndexer index = new JournalKeyIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-JOURNAL-KEYWORD is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-ORG-KEYWORD
                    indexDir = new File(path + IndexConst.ORG_KEYWORD_DIRECTORY_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    txtalog.append("\n--------------------INDEX-ORG-KEYWORD------------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-ORG-KEYWORD is running \n");
                        OrgKeyIndexer index = new OrgKeyIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-ORG-KEYWORD is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-RANK-AUTHOR
                    indexDir = new File(path + IndexConst.RANK_AUTHOR_INDEX_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    // Connect Database
                    txtalog.append("\n------------------INDEX-RANK-AUTHOR----------------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-RANK-AUTHOR is running \n");
                        _RankAuthorIndexer index = new _RankAuthorIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-RANK-AUTHOR is finished!");
                    }
                    txtalog.append("\n-----------------------------------------------------------------------\n");
                    connectionPool.getConnection().close();
                    connectionPool = null;

                    //INDEX-RANK-CONFERENCE
                    // Delete folder
                    indexDir = new File(path + IndexConst.RANK_CONFERENCE_INDEX_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    // Index
                    txtalog.append("\n-------------INDEX-RANK-CONFERENCE------------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-RANK-CONFERENCE is running \n");
                        _RankConfIndexer index = new _RankConfIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-RANK-CONFERENCE is finished!");
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    txtalog.append("\n-----------------------------------------------------------------------\n");

                    //INDEX-RANK-JOURNAL
                    // Delete folder
                    indexDir = new File(path + IndexConst.RANK_JOURNAL_INDEX_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    // Index
                    txtalog.append("\n------------------INDEX-RANK-JOURNAL--------------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-RANK-JOURNAL is running \n");
                        _RankJournalIndexer index = new _RankJournalIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-RANK-JOURNAL is finished!");
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    txtalog.append("\n-----------------------------------------------------------------------\n");

                    //INDEX-RANK-ORGANIZATION
                    indexDir = new File(path + IndexConst.RANK_ORG_INDEX_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    // Index
                    txtalog.append("\n--------------INDEX-RANK-ORGANIZATION----------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-RANK-ORGANIZATION is running \n");
                        _RankOrgIndexer index = new _RankOrgIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-RANK-ORGANIZATION is finished!");
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    txtalog.append("\n-----------------------------------------------------------------------\n");


                    //INDEX-RANK-KEYWORD
                    indexDir = new File(path + IndexConst.RANK_KEYWORD_INDEX_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    // Index
                    txtalog.append("\n-----------------INDEX-RANK-KEYWORD--------------------\n");
                    connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-RANK-KEYWORD is running \n");
                        _RankKeyIndexer index = new _RankKeyIndexer(path);
                        txtalog.append(index._run(connectionPool));
                        txtalog.append("\nINDEX-RANK-KEYWORD is finished!");
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    txtalog.append("\n-----------------------------------------------------------------------\n");


                    //INDEX-CHECKSPELL
                    // Delete folder
                    indexDir = new File(path + IndexConst.CHECKSPELL_DIRECTORY_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    // Index
                    txtalog.append("\n-------------------INDEX-CHECKSPELL----------------------\n");
                    CheckSpellIndexer IndexCheckSpell = new CheckSpellIndexer(path);
                    txtalog.append("Connect database success!\nINDEX-CHECKSPELL is running \n");
                    txtalog.append(IndexCheckSpell._run());
                    txtalog.append("\nINDEX-RANK-CHECKSPELL is finished!");
                    txtalog.append("\n-----------------------------------------------------------------------\n");

                    //INDEX-AUTOCOMPLETE
                    indexDir = new File(path + IndexConst.AUTOCOMPLETE_DIRECTORY_PATH);
                    if (indexDir.exists()) {
                        delete(indexDir);
                    }
                    // Index
                    txtalog.append("\n-----------------INDEX-AUTOCOMPLETE--------------------\n");
                    IndexAutocomplete Index = new IndexAutocomplete(path);
                    txtalog.append("Connect database success!\nINDEX-AUTOCOMPLETE is running \n");
                    txtalog.append(Index._run());
                    txtalog.append("\nINDEX-RANK-AUTOCOMPLETE is finished!");
                    txtalog.append("\n-----------------------------------------------------------------------\n");

                    //return
                    return null;
                }

                @Override
                public void done() {
                    prBar.setIndeterminate(false);
                    txtalog.append("\nAll Index Finished!\n");
                    setEnabledAll();
                }
            };
            Index.execute();
        } catch (Exception ex) {
            txtalog.setText(ex.getMessage());
        }
    }//GEN-LAST:event_btAutoRunActionPerformed

    private void btAuthorCitationActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAuthorCitationActionPerformed
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                prBar.setIndeterminate(false);
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.AUTHOR_CITATION_DIRECTORY_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-AUTHOR-CITATION is running \n");
                        AuthorCitationIndexer index = new AuthorCitationIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.append(ex.getMessage());
        }
    }//GEN-LAST:event_btAuthorCitationActionPerformed

    private void btAuthorCoAuthorActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAuthorCoAuthorActionPerformed
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                prBar.setIndeterminate(false);
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.AUTHOR_COAUTHOR_DIRECTORY_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-AUTHOR-COAUTHOR is running \n");
                        AuthorCoAuthorIndexer index = new AuthorCoAuthorIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.append(ex.getMessage());
        }
    }//GEN-LAST:event_btAuthorCoAuthorActionPerformed

    private void btAuthorConferenceActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAuthorConferenceActionPerformed
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                prBar.setIndeterminate(false);
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.AUTHOR_CONFERENCE_DIRECTORY_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-AUTHOR-CONFERENCE is running \n");
                        AuthorConfIndexer index = new AuthorConfIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.append(ex.getMessage());
        }
    }//GEN-LAST:event_btAuthorConferenceActionPerformed

    private void btAuthorJournalActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAuthorJournalActionPerformed
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                prBar.setIndeterminate(false);
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.AUTHOR_JOURNAL_DIRECTORY_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-AUTHOR-JOURNAL is running \n");
                        AuthorJournalIndexer index = new AuthorJournalIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.append(ex.getMessage());
        }
    }//GEN-LAST:event_btAuthorJournalActionPerformed

    private void btAuthorKeywordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btAuthorKeywordActionPerformed
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                prBar.setIndeterminate(false);
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.AUTHOR_KEYWORD_DIRECTORY_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-AUTHOR-KEYWORD is running \n");
                        AuthorKeyIndexer index = new AuthorKeyIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.append(ex.getMessage());
        }
    }//GEN-LAST:event_btAuthorKeywordActionPerformed

    private void btConferenceKeywordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btConferenceKeywordActionPerformed
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                prBar.setIndeterminate(false);
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.CONFERENCE_KEYWORD_DIRECTORY_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
                txtalog.append("Delete old INDEX file!\n");
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-CONFERENCE-KEYWORD is running \n");
                        ConferenceKeyIndexer index = new ConferenceKeyIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.append(ex.getMessage());
        }
    }//GEN-LAST:event_btConferenceKeywordActionPerformed

    private void btJournalKeywordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btJournalKeywordActionPerformed
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                prBar.setIndeterminate(false);
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.JOURNAL_KEYWORD_DIRECTORY_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
                txtalog.append("Delete old INDEX file!\n");
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-JOURNAL-KEYWORD is running \n");
                        JournalKeyIndexer index = new JournalKeyIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.append(ex.getMessage());
        }
    }//GEN-LAST:event_btJournalKeywordActionPerformed

    private void btOrgKeywordActionPerformed(java.awt.event.ActionEvent evt) {//GEN-FIRST:event_btOrgKeywordActionPerformed
        try {
            prBar.setIndeterminate(true);
            txtalog.setText("Begin!\n");
            this.setDisabledAll();
            this.path = this.txtPath.getText();
            final String user = txtUserName.getText();
            final String pass = txtPassWord.getText();
            final String database = txtDatabase.getText();
            final int port = Integer.parseInt(txtPort.getText());
            File file = new File(this.path);
            if (!file.exists()) {
                // It returns false if File or directory does not exist
                txtalog.append("Directory you are searching does not exist : " + file.exists() + "\n");
                this.setEnabledAll();
                prBar.setIndeterminate(false);
                return;
            } else {
                // It returns true if File or directory exists
                txtalog.append("Directory you are searching does exist : " + file.exists() + "\n");
                if (!"\\".equals(this.path.substring(this.path.length() - 1, this.path.length()))) {
                    this.path += "\\";
                    this.txtPath.setText(this.path);
                }
            }
            // Delete folder
            File indexDir = new File(this.path + IndexConst.ORG_KEYWORD_DIRECTORY_PATH);
            if (indexDir.exists()) {
                delete(indexDir);
                txtalog.append("Delete old INDEX file!\n");
            }
            // Connect Database
            SwingWorker<String, Void> worker = new SwingWorker<String, Void>() {
                @Override
                protected String doInBackground() throws Exception {
                    ConnectionPool connectionPool = new ConnectionPool(user, pass, database, port);
                    if (connectionPool.getConnection() == null) {
                        txtalog.append("Error: Can not connect to database!\n");
                    } else {
                        txtalog.append("Connect database success!\nINDEX-ORG-KEYWORD is running \n");
                        OrgKeyIndexer index = new OrgKeyIndexer(path);
                        txtalog.append(index._run(connectionPool));
                    }
                    connectionPool.getConnection().close();
                    connectionPool = null;
                    return null;
                }

                @Override
                public void done() {
                    txtalog.append("\nFinished!\n");
                    prBar.setIndeterminate(false);
                    setEnabledAll();
                }
            };
            worker.execute();
        } catch (Exception ex) {
            txtalog.append(ex.getMessage());
        }
    }//GEN-LAST:event_btOrgKeywordActionPerformed

    public void setDisabledAll() {
        this.btAuthorIndexer.setEnabled(false);
        this.btConferenceIndexer.setEnabled(false);
        this.btJournalIndexer.setEnabled(false);
        this.btKeywordIndexer.setEnabled(false);
        this.btOrgIndexer.setEnabled(false);
        this.btPaperIndexer.setEnabled(false);
        this.btRankPaper.setEnabled(false);
        this.btSubdomainIndexer.setEnabled(false);
        this.btCcidfIndexer.setEnabled(false);
        this.btRankAuthorIndexer.setEnabled(false);
        this.btRankConfIndexer.setEnabled(false);
        this.btRankJournalIndexer.setEnabled(false);
        this.btRankKeyIndexer.setEnabled(false);
        this.btRankOrgIndexer.setEnabled(false);
        this.btAutocompleteIndexer.setEnabled(false);
        this.btCheckSpellIndexer.setEnabled(false);
        this.btAutoRun.setEnabled(false);
        this.txtDatabase.setEditable(false);
        this.txtPassWord.setEditable(false);
        this.txtPath.setEditable(false);
        this.txtPort.setEditable(false);
        this.txtUserName.setEditable(false);
        this.txtalog.setEditable(false);
        this.btAuthorCitation.setEnabled(false);
        this.btAuthorCoAuthor.setEnabled(false);
        this.btAuthorConference.setEnabled(false);
        this.btAuthorJournal.setEnabled(false);
        this.btAuthorKeyword.setEnabled(false);
        this.btConferenceKeyword.setEnabled(false);
        this.btJournalKeyword.setEnabled(false);
        this.btOrgKeyword.setEnabled(false);
    }

    public void setEnabledAll() {
        this.txtDatabase.setEditable(true);
        this.txtPassWord.setEditable(true);
        this.txtPath.setEditable(true);
        this.txtPort.setEditable(true);
        this.txtUserName.setEditable(true);

        this.btAuthorCitation.setEnabled(true);
        this.btAuthorCoAuthor.setEnabled(true);
        this.btAuthorConference.setEnabled(true);
        this.btAuthorJournal.setEnabled(true);
        this.btAuthorKeyword.setEnabled(true);
        this.btConferenceKeyword.setEnabled(true);
        this.btJournalKeyword.setEnabled(true);
        this.btOrgKeyword.setEnabled(true);
        this.btAutoRun.setEnabled(true);
        this.btRankPaper.setEnabled(true);
        this.btCcidfIndexer.setEnabled(true);
        if (rankPaper) {
            this.btPaperIndexer.setEnabled(true);
        }
        if (IndexPaper) {
            this.btAuthorIndexer.setEnabled(true);
            this.btConferenceIndexer.setEnabled(true);
            this.btJournalIndexer.setEnabled(true);
            this.btKeywordIndexer.setEnabled(true);
            this.btOrgIndexer.setEnabled(true);
            this.btSubdomainIndexer.setEnabled(true);
        }
        if (aut) {
            btRankAuthorIndexer.setEnabled(true);
        }
        if (con) {
            btRankConfIndexer.setEnabled(true);
        }
        if (jou) {
            btRankJournalIndexer.setEnabled(true);
        }
        if (key) {
            btRankKeyIndexer.setEnabled(true);
        }
        if (org) {
            btRankOrgIndexer.setEnabled(true);
        }
        if (aut && key) {
            btCheckSpellIndexer.setEnabled(true);
        }
        if (aut && key && con && jou && org) {
            btAutocompleteIndexer.setEnabled(true);
        }
    }

    public static void delete(File file) throws IOException {
        if (file.isDirectory()) {
            //directory is empty, then delete it
            if (file.list().length == 0) {
                file.delete();
                //System.out.println("Directory is deleted : " + file.getAbsolutePath());
            } else {
                //list all the directory contents
                String files[] = file.list();
                for (String temp : files) {
                    //construct the file structure
                    File fileDelete = new File(file, temp);
                    //recursive delete
                    delete(fileDelete);
                }
                //check the directory again, if empty then delete it
                if (file.list().length == 0) {
                    file.delete();
                    System.out.println("Directory is deleted : " + file.getAbsolutePath());
                }
            }
        } else {
            //if file, then delete it
            file.delete();
            System.out.println("File is deleted : " + file.getAbsolutePath());
        }
    }

    /**
     * @param args the command line arguments
     */
    public static void main(String args[]) {
        /*
         * Set the Nimbus look and feel
         */
        //<editor-fold defaultstate="collapsed" desc=" Look and feel setting code (optional) ">
        /*
         * If Nimbus (introduced in Java SE 6) is not available, stay with the
         * default look and feel. For details see
         * http://download.oracle.com/javase/tutorial/uiswing/lookandfeel/plaf.html
         */
        try {
            for (javax.swing.UIManager.LookAndFeelInfo info : javax.swing.UIManager.getInstalledLookAndFeels()) {
                if ("Nimbus".equals(info.getName())) {
                    javax.swing.UIManager.setLookAndFeel(info.getClassName());
                    break;
                }
            }
        } catch (ClassNotFoundException ex) {
            java.util.logging.Logger.getLogger(MainIndexForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (InstantiationException ex) {
            java.util.logging.Logger.getLogger(MainIndexForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (IllegalAccessException ex) {
            java.util.logging.Logger.getLogger(MainIndexForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        } catch (javax.swing.UnsupportedLookAndFeelException ex) {
            java.util.logging.Logger.getLogger(MainIndexForm.class.getName()).log(java.util.logging.Level.SEVERE, null, ex);
        }
        //</editor-fold>

        /*
         * Create and display the form
         */
        java.awt.EventQueue.invokeLater(new Runnable() {
            public void run() {
                new MainIndexForm().setVisible(true);
            }
        });
    }
    // Variables declaration - do not modify//GEN-BEGIN:variables
    private javax.swing.JButton btAuthorCitation;
    private javax.swing.JButton btAuthorCoAuthor;
    private javax.swing.JButton btAuthorConference;
    private javax.swing.JButton btAuthorIndexer;
    private javax.swing.JButton btAuthorJournal;
    private javax.swing.JButton btAuthorKeyword;
    private javax.swing.JButton btAutoRun;
    private javax.swing.JButton btAutocompleteIndexer;
    private javax.swing.JButton btCcidfIndexer;
    private javax.swing.JButton btCheckSpellIndexer;
    private javax.swing.JButton btConferenceIndexer;
    private javax.swing.JButton btConferenceKeyword;
    private javax.swing.JButton btJournalIndexer;
    private javax.swing.JButton btJournalKeyword;
    private javax.swing.JButton btKeywordIndexer;
    private javax.swing.JButton btOrgIndexer;
    private javax.swing.JButton btOrgKeyword;
    private javax.swing.JButton btPaperIndexer;
    private javax.swing.JButton btRankAuthorIndexer;
    private javax.swing.JButton btRankConfIndexer;
    private javax.swing.JButton btRankJournalIndexer;
    private javax.swing.JButton btRankKeyIndexer;
    private javax.swing.JButton btRankOrgIndexer;
    private javax.swing.JButton btRankPaper;
    private javax.swing.JButton btSubdomainIndexer;
    private javax.swing.JLabel jLabel1;
    private javax.swing.JLabel jLabel2;
    private javax.swing.JLabel jLabel3;
    private javax.swing.JLabel jLabel4;
    private javax.swing.JLabel jLabel5;
    private javax.swing.JScrollPane jScrollPane1;
    private javax.swing.JProgressBar prBar;
    private javax.swing.JTextField txtDatabase;
    private javax.swing.JTextField txtPassWord;
    private javax.swing.JTextField txtPath;
    private javax.swing.JTextField txtPort;
    private javax.swing.JTextField txtUserName;
    private javax.swing.JTextArea txtalog;
    // End of variables declaration//GEN-END:variables
}
